var _page = $('.page')
// 加载最新单身列表
var thisload1 = bottlecms.load({
    elem: $('.infinite-like1'),
    scroll: $('.infinite-scroll1'),
    done: function (page, next) {
        var src = this.elem.attr("pages-src");
        bottlecms.get(src, {
            page: page
        }, function (data) {
            var lis = [];
            for (var o in data.list) {
                lis.push(userlist_template(data.list[o]))
            }
            next(lis.join(''), lis.length);
        })
    }
})
var thisload2 = bottlecms.load({
    elem: $('.infinite-like2'),
    scroll: $('.infinite-scroll2'),
    done: function (page, next) {
        var src = this.elem.attr("pages-src");
        bottlecms.get(src, {
            page: page
        }, function (data) {
            var lis = [];
            for (var o in data.list) {
                lis.push(userlist_template(data.list[o]))
            }
            next(lis.join(''), lis.length);
        })
    }
})
var thisload3 = bottlecms.load({
    elem: $('.infinite-like3'),
    scroll: $('.infinite-scroll3'),
    done: function (page, next) {
        var src = this.elem.attr("pages-src");
        bottlecms.get(src, {
            page: page
        }, function (data) {
            var lis = [];
            for (var o in data.list) {
                lis.push(userlist_template(data.list[o]))
            }
            next(lis.join(''), lis.length);
        })
    }
})


var tabload = function () {
    setTimeout(function () {
        if ($('.bcui-tab .bcui-tab-content .item.active .infinite-like1').length > 0) {
            thisload1.load();
        } else if ($('.bcui-tab .bcui-tab-content .item.active .infinite-like2').length > 0) {
            thisload2.load();
        } else if ($('.bcui-tab .bcui-tab-content .item.active .infinite-like3').length > 0) {
            thisload3.load();
        }
    }, 100)
}

$(_page).on('click', '.bcui-tab .bcui-tab-title .item', function (event) {
    tabload();
});
tabload();